package cn.itsource.ymcc.producer;

import cn.itsource.ymcc.constant.OrderConstants;
import cn.itsource.ymcc.constant.PayConstants;
import com.alibaba.fastjson.JSON;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class PayProducerImpl implements IPayProducer {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @Override
    public void updateCourseOrderStatus(Map<String,Object> param) {
        rocketMQTemplate.sendOneWay(PayConstants.TOPIC_PAY_ORDER_MESSAGE+":"+PayConstants.TAGS_PAY_ORDER_MESSAGE,
                MessageBuilder.withPayload(JSON.toJSONString(param)).build());
    }

}
